%This file creates the data for Figure 5a and saves it in
%\Replication_files\mat_files\fig5a_data.mat

clear
cd ../mat_files

for a=0:0.05:5
    cd ../m_files
    set_parameters(a,0,1.51,-.52,0.8,15,1,0,8);
    cd ../mod_files
    dynare a15_markups.mod
    L=length(mu_e);
    sign_var=sign(mu_e(1:L-1).*mu_e(2:L));
    [I,temp]=find(sign_var<0);
    d=min(I);
    if mu_e(d)<0 
        d=0;
    end
    cd ../mat_files
    if a==0
        duration=d;
    else
        load('fig5a_data.mat');
        duration=[duration d];
    end
    save('fig5a_data.mat','duration');
end

cd ../m_files